package com.example.demo1104.demo2;

import java.util.function.Consumer;

/**
 * 静态方法的引用
 */
public class Test01 {
    public static void main(String[] args) {

        Consumer<int[]> consumer=(arr)->{Test01.sum(arr);};
        Consumer<int[]> consumer01=Test01::sum;
        int[] arr={1,3,5,7,9};
        consumer.accept(arr);
        consumer01.accept(arr);

    }
    public static  void sum(int[] arr){

        int sum=0;
        for (int b:arr){
            sum += b;
        }
        System.out.println("sum = " + sum);
    }


}
